package com.ruoyi.wm.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.wm.domain.WmMedicineInventory;
import com.ruoyi.wm.service.IWmMedicineInventoryService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 药品库存清算Controller
 * 
 * @author hpf
 * @date 2021-11-28
 */
@Controller
@RequestMapping("/wm/medicine_Inventory_list")
public class WmMedicineInventoryController extends BaseController
{
    private String prefix = "wm/medicine_Inventory_list";

    @Autowired
    private IWmMedicineInventoryService wmMedicineInventoryService;

    @RequiresPermissions("wm:medicine_Inventory_list:view")
    @GetMapping()
    public String medicine_Inventory_list(String name, Model model)
    {
        model.addAttribute("name",name);
        return prefix + "/medicine_Inventory_list";
    }

    /**
     * 查询药品库存清算列表
     */
    @RequiresPermissions("wm:medicine_Inventory_list:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(String name)
    {
        startPage();
        List<WmMedicineInventory> list = wmMedicineInventoryService.selectWmMedicineInventoryListByName(name);
        return getDataTable(list);
    }

    /**
     * 导出药品库存清算列表
     */
    @RequiresPermissions("wm:medicine_Inventory_list:export")
    @Log(title = "药品库存清算", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(WmMedicineInventory wmMedicineInventory)
    {
        List<WmMedicineInventory> list = wmMedicineInventoryService.selectWmMedicineInventoryList(wmMedicineInventory);
        ExcelUtil<WmMedicineInventory> util = new ExcelUtil<WmMedicineInventory>(WmMedicineInventory.class);
        return util.exportExcel(list, "medicine_Inventory_list");
    }

}
